const { sendFn, querySql, intercept } = require('../../model/send')
const dataFn = require('./common')

const GuitarMethod = {
  // 查询 指弹 分页方法
  BurgeesetFn: async (req, res) => {
    var query = req.query || req.param || req.body
    var num = query.pageNo

    if (num > 1) {
      num = (num - 1) * query.pageSize
    } else {
      num = `0`
    }
    const resp = await querySql(res, `SELECT * FROM burgeeset`, false)
    const result = dataFn(resp).slice(num, query.pageSize * query.pageNo)
    sendFn(res, 200, '获取成功', result, dataFn(resp).length)
  },
  // 查询 弹唱 分页方法
  GuitarsetFn: async (req, res) => {
    var query = req.query || req.param || req.body
    var num = query.pageNo

    if (num > 1) {
      num = (num - 1) * query.pageSize
    } else {
      num = `0`
    }
    const resp = await querySql(res, `SELECT * FROM guitarset`, false)
    const result = dataFn(resp).slice(num, query.pageSize * query.pageNo)
    sendFn(res, 200, '获取成功', result, dataFn(resp).length)
    console.log(result)


  },
  // 查询 模糊搜索 指弹 方法
  GuitarseStearchFn: async (req, res) => {

    const resp = await querySql(res, `SELECT * FROM guitarset`, false)
    const result = dataFn(resp).slice(num, query.pageSize * query.pageNo)
    sendFn(res, 200, '获取成功', result, dataFn(resp).length)


  }
}

module.exports = GuitarMethod
